﻿#ifndef __STARTSCENE_SCENE_H__
#define __STARTSCENE_SCENE_H__

#include "cocos2d.h"
#include "ui/CocosGUI.h"

#include <vector>
class Hero;
class HeroUpLayer;
class WeaponUpLayer;
class CoinUpLayer;
class StartScene : public cocos2d::Layer
{
public:
	StartScene();
    static cocos2d::Scene* createScene();
    virtual bool init();
	void onEnter();
	void onExit();
	void update(float dt);
	void initCSBFile();//加载csb文件
	void runStartSceneAct();//运行开始场景中的动画
	void initHero();
	void initLevelNode();//初始化关卡节点
	void initSpriteFrameCache();
	void heroMove(float dt);//监听英雄移动的调度器
	void heroMoveTo();
	void openBtnLiener();//开启下方的三个按钮的事件监听
	void delayEnterGameSence(float dt);//延迟进入游戏场景调度器
	void checkCloseBtn();
	void subCoin(int coin);
    CREATE_FUNC(StartScene);

private:
	bool isOpenBtn;
	int totalCoin;
	cocos2d::SpriteFrameCache* gameSpriteCache;
	cocos2d::Size size;
	cocos2d::Node* rootNode;
	cocos2d::Node* coinNode;
	cocos2d::Node* levelNode;
	cocos2d::ui::Text* coin_num;
	std::vector<cocos2d::ui::Button*> upBtns;
	std::vector<cocos2d::Sprite*> selecteds;
	std::vector<cocos2d::Sprite*> upIcons;
	std::vector<cocos2d::Layer*> layers;
	std::vector<cocos2d::Node*> startUiNode;
	cocos2d::Node* startGame;
	Hero* hero;
};

#endif // __STARTSCENE_SCENE_H__
